UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IomuJBSKaZHaW1UR76P2ER0RcbDUhhWWT0UI4RgOwYo=' 
WHERE 
  key_id = '284b45272981a49f67523e957c879932268de1e2b8e37c6e41854d0f5133f2c1' 
  AND (
    token = 'IomuJBSKaZHaW1UR76P2ER0RcbDUhhWWT0UI4RgOwYo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048