UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZTjPaUkDgcmrqIYVTpoPi+urt4FKQikm+rU1N8qIX4Y=' 
WHERE 
  key_id = 'e991424ac5fe6f2c94d092cdee69eb4f9c257fb4bd770b30d90a70f519453ae3' 
  AND (
    token = 'ZTjPaUkDgcmrqIYVTpoPi+urt4FKQikm+rU1N8qIX4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073