UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ai38sLLvxEZBGG1NrX2PfWFDYD0DmLuUaLxTGEAyh9c=' 
WHERE 
  key_id = 'a3958053f2ca93dc1026bbd8504404af7883dc4f7a90298ee3072343eddc7398' 
  AND (
    token = 'ai38sLLvxEZBGG1NrX2PfWFDYD0DmLuUaLxTGEAyh9c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026