UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AlitwjlG7G3a1JeRZgZ1Ci2wdFpzoF6M9iTAYyntVLk=' 
WHERE 
  key_id = 'b6846024b4279e45dcb10c651cc77f2a8a0df4cb546f39ee66cd72e24de7db0b' 
  AND (
    token = 'AlitwjlG7G3a1JeRZgZ1Ci2wdFpzoF6M9iTAYyntVLk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026