UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7DGjYVgz99StVpNAREjd5g5yCNtCge5/5uoteCZRUFE=' 
WHERE 
  key_id = '1a8794931d9590e2a9b4826b30c32f77c5114c01ef91fbb1b48ff3746bb1a22e' 
  AND (
    token = '7DGjYVgz99StVpNAREjd5g5yCNtCge5/5uoteCZRUFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048