UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQfx8pq1vryQ/Jvx6rvNkuDBesVrNhgg0ayYQ59oJYg=' 
WHERE 
  key_id = 'fef2aedc7ca6c42c25976918987a53e023903d3414603d47c5baa1a99ee3d6c6' 
  AND (
    token = 'hQfx8pq1vryQ/Jvx6rvNkuDBesVrNhgg0ayYQ59oJYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040