UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ALTvslQchIBv+yoCI7t2gXbwMYNAV78pNlvMfgZQQfY=' 
WHERE 
  key_id = 'f4b7bfbc6aed46c45a6005b8abd6959306d0035868f4921784de1020e213c0f1' 
  AND (
    token = 'ALTvslQchIBv+yoCI7t2gXbwMYNAV78pNlvMfgZQQfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034