UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/Yqt2EWZJ7SbP30n9KzS/85PpiVdVY434hvkpDjzYY=' 
WHERE 
  key_id = 'd0d574437f263766636d0337a2087a723a213ffe49ccb4dad0ce57b947ee3dc5' 
  AND (
    token = 'I/Yqt2EWZJ7SbP30n9KzS/85PpiVdVY434hvkpDjzYY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032