UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ERjNNDrbXnklxkXmpNVskpBLIFVnxS+4UNQT8hCMoMk=' 
WHERE 
  key_id = '1d963a40a04c0a64b979d1bb55500246d0bf6270fa4ab1df83c6da96c214dd1c' 
  AND (
    token = 'ERjNNDrbXnklxkXmpNVskpBLIFVnxS+4UNQT8hCMoMk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049