UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M62qCJCWanAI8ZgVd6ym3kkLoMz2ubSxdU+nOSmfUOo=' 
WHERE 
  key_id = 'd2a54f5f13f9a184f6744f10d40e5411c831abe866f27a3143a0308f582f2c74' 
  AND (
    token = 'M62qCJCWanAI8ZgVd6ym3kkLoMz2ubSxdU+nOSmfUOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026