UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dQF4q0frPzABLxncKqByuFdS0CBB1wm6huJo+f5DeIE=' 
WHERE 
  key_id = '4fd81264b698466fedca2cd68b6c16e0ec8de6d05a5bd153ac99707b5d096b39' 
  AND (
    token = 'dQF4q0frPzABLxncKqByuFdS0CBB1wm6huJo+f5DeIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026