UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j/UkYfOI1Sw+cJdeSYsL9z/L2Uy0rjQT7Kbyn6Jb8Os=' 
WHERE 
  key_id = 'd328de3e95b8a4f38046b5d537fa6759f048b104f8f35e77cf73c286a96f5941' 
  AND (
    token = 'j/UkYfOI1Sw+cJdeSYsL9z/L2Uy0rjQT7Kbyn6Jb8Os=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040