UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pd3JjD/iLl12p/FcDPbXF+eqH3HtPyMQSNT37O2gcRw=' 
WHERE 
  key_id = '3d360f114a0db857da8642d5c1cf7a04c012a8f96de7e36576b6496187ca286f' 
  AND (
    token = 'pd3JjD/iLl12p/FcDPbXF+eqH3HtPyMQSNT37O2gcRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071