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

Query time 0.00038