UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '23OJO+K6qwwfNA8AWM5Qhw5fCuLoml2/LEY3RBjMTiM=' 
WHERE 
  key_id = 'c2cf843dd257353dadb5867d768e6e401f212c4d9a3295c739934180f0deecee' 
  AND (
    token = '23OJO+K6qwwfNA8AWM5Qhw5fCuLoml2/LEY3RBjMTiM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022