UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WBMuRgdBJ/kwG1/ckKWPywoyG0KJWIlLyZpvD2yN4OQ=' 
WHERE 
  key_id = '7d7fe4c453e802543565327251b4905dbfdc1f6928e6b269d59954fd652ca048' 
  AND (
    token = 'WBMuRgdBJ/kwG1/ckKWPywoyG0KJWIlLyZpvD2yN4OQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055