UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NRtSxj2rjF38edXytxmN/0Lec6nd6o6ovamMNARFIBY=' 
WHERE 
  key_id = '3d95fdbfc2e7de775973c70ed4d360b9fb260f18f9f6615b0e61095bba1e63f0' 
  AND (
    token = 'NRtSxj2rjF38edXytxmN/0Lec6nd6o6ovamMNARFIBY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028