UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2Wm7KRn8X+y7wr1sL5guHNokwsitdt2BHk6n950zgE=' 
WHERE 
  key_id = 'e512f52ee5b03a69f6ff4834b2bba3987f67472a0c4ed1dd355b5078e9703609' 
  AND (
    token = 'N2Wm7KRn8X+y7wr1sL5guHNokwsitdt2BHk6n950zgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040