UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WB017IBnTMbfbslBUZ8TN3i8upnqm3wZGRtmr/AsGLQ=' 
WHERE 
  key_id = '7ca625e7fa4b71f5aa1f1ca32c7d34c7331e8d349984087c44f5ce8f0b50ee05' 
  AND (
    token = 'WB017IBnTMbfbslBUZ8TN3i8upnqm3wZGRtmr/AsGLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024