UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YnB5N7ahQGuXfKdiIj0Ns+NFFOC3UokYwiRiOM1Ttzg=' 
WHERE 
  key_id = '1aaa926da0176f02e6db82649dda717104c36909532fdc54500daae034f45b79' 
  AND (
    token = 'YnB5N7ahQGuXfKdiIj0Ns+NFFOC3UokYwiRiOM1Ttzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057