UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yqA07cW6STPI9l9bZ1EVvsX2wuhSKqAUWDubX/fyO3A=' 
WHERE 
  key_id = '41597679076c650caf460e92ea91c2a886b881a5c710b7af5b68bf5630b1caa8' 
  AND (
    token = 'yqA07cW6STPI9l9bZ1EVvsX2wuhSKqAUWDubX/fyO3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034