UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8YEbWL03gxzGmjeECXXOAf/MD2vUVsigYvXqn0LiMKw=' 
WHERE 
  key_id = '462e40b11137433ae57e1b38a282d542e636e6d2cd58a17d527cc8ac1bc47d6a' 
  AND (
    token = '8YEbWL03gxzGmjeECXXOAf/MD2vUVsigYvXqn0LiMKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064