UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DwcwUspKH1085SQKiitgvmUIa9KhtqVm/VR1wX1M8pc=' 
WHERE 
  key_id = '27c073c05083d27b2aec102ee3fea8d629e89c8c0f35353513a4b3fd96ec631d' 
  AND (
    token = 'DwcwUspKH1085SQKiitgvmUIa9KhtqVm/VR1wX1M8pc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050