UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GZIj9RUT6XVFUW+dr8YbUgdF14Qwt/nMrF3tCny2z8c=' 
WHERE 
  key_id = '1622036dc48361e8ca41176161901e10593adf0d87c3f194bfe3d94f61876ae4' 
  AND (
    token = 'GZIj9RUT6XVFUW+dr8YbUgdF14Qwt/nMrF3tCny2z8c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037