UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p1FtTnu7e51HsTIS4GGvhv5J7VZ0vx5fnQ3OkbGbBjo=' 
WHERE 
  key_id = 'f72bf8e6fe8af0bc71cb1e4331ec44655d204123b72625d3912c141251efc495' 
  AND (
    token = 'p1FtTnu7e51HsTIS4GGvhv5J7VZ0vx5fnQ3OkbGbBjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044