UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mAIroPC8Hyaef7u5WiHf+TDj18XUyEkl5XMkF2NoeuY=' 
WHERE 
  key_id = '42880f08e18a8ad8df1350dc0b040ac6111f5ae9524a01baa230b990c930494a' 
  AND (
    token = 'mAIroPC8Hyaef7u5WiHf+TDj18XUyEkl5XMkF2NoeuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032