UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qfJD/uEFxDHQh/fOQuZ5tAFE+sC7MbNsF9Z0gy1TRtQ=' 
WHERE 
  key_id = 'e58946ceeb1c45a17e29ad8d5b2b0844178bb526807d665d75bb188964a474fb' 
  AND (
    token = 'qfJD/uEFxDHQh/fOQuZ5tAFE+sC7MbNsF9Z0gy1TRtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052