UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pu0dYhSI6Wlb8N/tWx0+xfKZPJWQHJH8R1zCJcj3xs0=' 
WHERE 
  key_id = 'b2444ce15561e4bd2ca655745951f4d3ad6c9cfad03de1fffa502b8e59b54284' 
  AND (
    token = 'pu0dYhSI6Wlb8N/tWx0+xfKZPJWQHJH8R1zCJcj3xs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032