UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KoyiZn77qWTfjH4XRcRs8eEsH731EgWH2PhAXCMxdCs=' 
WHERE 
  key_id = '7df9c7c5629e5a779dffb849a3d7543652b0c24331d9565a31ca5daba76c0fe7' 
  AND (
    token = 'KoyiZn77qWTfjH4XRcRs8eEsH731EgWH2PhAXCMxdCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018